/**
 * 2016-4-8 下午03:16:39
 */
package com.carpo.info.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

import com.carpo.info.Producer;
import com.carpo.info.model.LazyStatus;
import com.carpo.info.model.TInfos;


/**
 * 
 * @since jdk1.6
 * @date 2016-4-8
 *  
 */

public class SaveHelper {
	
	public Object doAfter(ProceedingJoinPoint jp) {
		Object obj = null;
		try {
			obj = jp.proceed();
		} catch (Throwable e) {
			e.printStackTrace();
		}
		if(obj instanceof Boolean){
			Boolean bool = (Boolean)obj;
			if(bool.booleanValue()){
				System.out.println(".............doAfter");
				Object[] objArr = jp.getArgs();
				if(null != objArr && objArr.length > 0){
					Object objInfo = objArr[0];
					if(objInfo instanceof TInfos){
						TInfos info = (TInfos) objInfo;
						if(LazyStatus.NO.equals(info.getIsLazy())){
							Producer.product(info);
						}
					}
				}
			}
		}
		return obj;
	}
}
